-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Backport] Fix condition Safe-NULL condition on Update Trigger #23079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backport] Fix condition Safe-NULL condition on Update Trigger #23079
Conversation
Hi @sebastien-kathmandu. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
I forgot to specify that it impacts also the branch |
Hi @sebastien-kathmandu. Thank you for your request. I'm working on Magento 2.2-develop instance for you |
Hi @sebastien-kathmandu, here is your Magento instance. |
@akaplya would be really nice if you can review this MView/Staging logic change. |
Hi @sebastien-kathmandu Did you open a PR for 2.3 branch? |
Hi @rodrigowebjump , We are still using Cheers, |
Thanks @sebastien-kathmandu for this fix ! I think that triggers should be reinstalled after applying this as a patch, or upgrading to a version that contains it, no ? In the absence of a command to do that, or even proper documentation (see #23023 and magento/devdocs#4647 ), should this PR contain a setupUpgrade script that reinstalls all triggers ? Is that even doable ? Anyway, a |
Hi @QuentinFarizonAfrimarket , It's a really good point. We did in our environment by switching the indexes to Cheers, |
There is |
Yes, |
Its called every upgrade already :) |
Hi @paales and @QuentinFarizonAfrimarket , I looked and indeed it should do it. But when we deployed the fix into our staging and production environment, the cli Cheers, |
@sebastien-kathmandu: it might be better to first submit a PR which targets the (for the people interested: there is also some discussion going on around this PR and the history of this bug in https://magentocommeng.slack.com/archives/C4YS78WE6/p1560763042380000) |
For people looking at this PR there is also this logic in a Catalog Staging class in the Commerce version |
Hi @mattheo-geoffray , Indeed in the file Thanks @mattheo-geoffray . Cheers, |
Hi @sebastian-virtua. The branch |
Hi @sebastien-kathmandu |
Hi @sebastien-kathmandu, thank you for your contribution! |
Description (*)
Safe-NULL in the Update Trigger created by View is used in the wrong way. As we are using an external integration system using INSERT INTO ... ON DUPLICATE KEY UPDATE
value
= ... on most on our product ( for example stock, prices, varchar attribute) each integration is followed by a reindex of most of our products that are not really updated. And impact a lot the performances of our database.Fixed Issues (if relevant)
Manual testing scenarios (*)
To understand the condition used before and after the commit df5597a2e and the solution proposed in this Pull Request.
I'm doing this benchmark playground :
here the result of the last query:
Before
as we can see before the commit the NULL condition could cause a lot of trouble if for example a previous attribute were NULL or become NULL as change the
After
Only if the both value are the same we got
true
.if we look a classic line in a trigger for example :
trg_catalog_product_entity_int_after_update
if at least one of these fields (
value_id
,attribute_id
,store_id
,row_id
,value
) didn't change we will always insert a new row insidecatalog_product_flat_cl
. And this is always the case.Contribution checklist (*)